<template>
  <div class="index">
    <h2>会员概况</h2>
    <div class="index-data">
      <div class="data-item">
          <p>粉丝数</p>
          <p><b>{{mainPageData.funsTotal}}</b></p>
      </div>
      <div class="data-item">
          <p>新增粉丝</p>
          <p><b>{{mainPageData.newFuns}}</b></p>
      </div>
      <div class="data-item">
          <p>浏览量</p>
          <p><b>{{mainPageData.lookCount}}</b></p>
      </div>
      <div class="data-item">
          <p>最近一周浏览量</p>
          <p><b>{{mainPageData.lookCountMonth}}</b></p>
      </div>
    </div>
    <div class="index-data-block">
      <div class="data-item clearfix">
        <label>会员积分</label>
        <b>0</b>
        <span @click="showIntro(0)"><span>会员积分说明</span><i><a-icon type="question" /></i></span>
      </div>
      <div class="data-item clearfix">
        <label>会员等级</label>
        <b>LV1</b>
        <span @click="showIntro(1)"><span>会员等级说明</span><i><a-icon type="question" /></i></span>
      </div>
    </div>
    <a-modal width="40%" cancelText="关闭" v-model="showPreviewModal" class="pic-preview" title="说明">
      <div>{{text}}</div>
    </a-modal>
    <!-- <index-chart v-if="indexStyle==1"></index-chart>
    <index-bdc v-if="indexStyle==2"></index-bdc>
    <index-task v-if="indexStyle==3"></index-task>
    <div style="width: 100%;text-align: right;margin-top: 20px">
      请选择首页样式：
      <a-radio-group v-model="indexStyle">
        <a-radio :value="1">统计图表</a-radio>
        <a-radio :value="2">统计图表2</a-radio>
        <a-radio :value="3">任务表格</a-radio>
      </a-radio-group>
    </div> -->
  </div>
</template>

<script>
  import IndexChart from './IndexChart'
  import IndexTask from "./IndexTask"
  import IndexBdc from './IndexBdc'
  import { httpAction,postAction } from '@/api/manage'
  export default {
    name: "Analysis",
    components: {
      IndexChart,
      IndexTask,
      IndexBdc
    },
    data() {
      return {
        mainPageData:{},
        text:'',
        showPreviewModal:false,
        intro:[{
          text:'积分积分',
        },{
          text:'等级',
        },],
        indexStyle:1
      }
    },
    created() {
      this.getData();
    },
    methods: {
      showIntro(type){
        this.showPreviewModal = true;
        this.text = this.intro[type].text;
      },
      getData(){
        this.mainPageData = {};
        httpAction('/tc/company/statistics',{},'GET').then((res)=>{
          if(res.success){
            this.mainPageData = res.result?res.result:{};
          }
        }).catch((e)=>{

        })
      },
    }
  }
</script>
<style>
  .index{
    background:#ffffff;
    padding: 15px;
  }
  .index-data{
    display: flex;
    justify-content: space-around;
    padding:20px 0px;
    background-color: #efefef;
    margin-bottom: 20px;
  }
  .index-data .data-item{
    width: 100px;
    display: inline-block;
  }
  .index-data .data-item p{
    line-height: 30px;
    height: 30px;
    overflow: hidden;
    text-align: center;
  }
  .index-data-block{
    padding:20px 50px;
    background-color: #efefef;
    margin-bottom: 20px;
  }
  .index-data-block .data-item{
    margin-bottom: 20px;
  }
  .index-data-block .data-item label{
    display: inline-block;
    width: 110px;
    float: left;
    font-size: 18px;
  }
  .index-data-block .data-item b{
    display: inline-block;
    float: left;
    line-height: 26px;
  }
  .index-data-block .data-item >span{
    display: inline-block;
    float: right;
    width:200px;
    text-align: right;
    cursor: pointer;
  }
  .index-data-block .data-item span span{
    font-size: 14px;
    color:#999999;
  }
  .index-data-block .data-item span >i{
    display: inline-block;
    margin-left: 5px;
    width: 16px;
    height: 16px;
    border-radius:50%;
    background:#cccccc;
    float: right;
    margin-top:3px;
  }
  .index-data-block .data-item span >i >i{
    display: block;
    margin-top: 2px;
    color: #888888;
    font-size: 12px;
  }
</style>